package com.koron.common.web.controller;

import com.koron.common.core.util.aes.AesException;
import com.koron.common.core.util.aes.WXBizMsgCrypt;
import com.koron.common.core.util.aes.bean.VertifyBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName SendMsController
 * @description
 * @Author zhouj
 * @Date 2021/5/11 10:28
 */
@Slf4j
@RestController
@RequestMapping("/common")
public class SendMsController {

    @GetMapping("/sendMs")
    public String testSendMs(VertifyBean vertifyBean) {
        String result = null;
        try {
            WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt("wx018e", "fyKDWvL5zgmSbV8InLIeZ1hGewrCZpZyY8xUmp3SNyD", "wx018e73a13189ec01");
            result = wxBizMsgCrypt.verifyUrl(vertifyBean.getSignature(), vertifyBean.getTimestamp(), vertifyBean.getNonce(), vertifyBean.getEchostr());
        } catch (AesException e) {
            log.error(e.getMessage());
        }
        return vertifyBean.getEchostr();
    }

}
